package com.devops.admin.graphql;

import com.devops.admin.service.DOSAliyunLogService;
import com.devops.common.annotation.DOSLog;
import com.devops.constant.DevOpsConstant;
import com.netflix.graphql.dgs.DgsComponent;
import com.netflix.graphql.dgs.DgsQuery;
import com.netflix.graphql.dgs.InputArgument;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @ClassName DOSAliYunLogDataFetcher
 * @Description 查询阿里云日志页面
 * @Author heyabo
 * @Date 2022/8/3 15:25
 * @Version 1.0
 **/
@DgsComponent
public class DOSAliYunLogDataFetcher {

    @Autowired
    private DOSAliyunLogService dosAliyunLogService;

    /**
     * @Author heyabo
     * @Description 查询登录阿里云查看日志的url
     * @Date 15:29 2022/7/25
     * @Param [releaseId]
     * @return java.lang.String
     **/
    @DgsQuery
    @DOSLog(description = "查询登录阿里云查看日志的url")
    @RequiresPermissions(DevOpsConstant.RoleCode.LOGIN_USER)
    public String getLoginUrl(@InputArgument Integer releaseId){

        return dosAliyunLogService.getLoginUrl(releaseId);
    }

    /**
     * @Author heyabo
     * @Description 重定向日志查看页面
     * @Date 10:20 2022/7/27
     * @Param [releaseId]
     * @return java.lang.String
     **/
    @DgsQuery
    @DOSLog(description = "重定向日志查看页面")
    @RequiresPermissions(DevOpsConstant.RoleCode.LOGIN_USER)
    public String redirectUrl(@InputArgument Integer releaseId){

        return dosAliyunLogService.redirect(releaseId);
    }
}
